package com.sk.weichat.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.view.ViewGroup;
import android.widget.FrameLayout;

/**
 * @Author: chenzl
 * @ClassName: SubjectButtomDialog
 * @Description: java类作用描述
 * @CreateDate: 2019/10/24 17:31
 */
public class SubjectButtomDialog extends BottomSheetDialog {

    private Context context;
    public SubjectButtomDialog(@NonNull Context context) {
        super(context);
        this.context = context;
    }

    public SubjectButtomDialog(@NonNull Context context, int theme) {
        super(context, theme);
    }

    public SubjectButtomDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onStart() {
        super.onStart();

    }

    @Override
    public void show() {
        super.show();
        //设置高度
        FrameLayout bottomSheet = (FrameLayout) findViewById(android.support.design.R.id.design_bottom_sheet);
        ViewGroup.LayoutParams originLayoutParams = bottomSheet.getLayoutParams();
        int height = (int) (context.getResources().getDisplayMetrics().heightPixels)-154;
        originLayoutParams.height = height;
        bottomSheet.setLayoutParams(originLayoutParams);
        BottomSheetBehavior mDialogBehavior = BottomSheetBehavior.from(bottomSheet);
        mDialogBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
    }
}
